package draftMate.player;

import draftMate.Stat;

public class Pitcher {
    public static final int NUM_FIELDS = 6;
    public static final int ROW_SIZE = 10;
    public static final int NAME = 0;
    public static final int W = 1;
    public static final int ERA = 2;
    public static final int WHIP = 3;
    public static final int K = 4;
    public static final int SV = 5;
    private static final int ER = 6;
    private static final int BB = 7;
    private static final int H = 8;
    private static final int IP = 9;		

    private Object [] row;
    
    public Pitcher(String name, double wins, double eR, double walks,
            double hits, double ip, double k, double saves) {
        super();
        row = new Object[ROW_SIZE];
        row[NAME] = name;
        row[W] = wins;
        row[ER] = eR;
        row[BB] = walks;
        row[H] = hits;
        row[IP] = ip;
        row[K] = k;
        row[SV] = saves;
        
        row[ERA] = (eR * 9) / (double)ip;
        row[WHIP] = (walks + hits) / (double)ip;
    }
    
    public String getName() {
        return (String)row[NAME];
    }
    public double getWins() {
        return (double)row[W];
    }
    public double getER() {
        return (double)row[ER];
    }
    public double getWalks() {
        return (double)row[BB];
    }
    public double getHits() {
        return (double)row[H];
    }
    public double getIp() {
        return (double)row[IP];
    }
    public double getK() {
        return (double)row[K];
    }
    public double getSaves() {
        return (double)row[SV];
    }
    
    public Object getValAt(int c) {
        return row[c];
    }
    
    public String toString() {
        String string = "";
        for (int i = 0; i < ROW_SIZE; i++) {
            if (i != ERA && i != WHIP) {
                string += row[i] + ",";
            }
        }
        return string;
    }
}